//
//  Tool.h
//  呼应
//
//  Created by apple on 15/6/24.
//  Copyright (c) 2015年 apple. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "AFNetworking.h"
#define IOS7_OR_LATER		( [[[UIDevice currentDevice] systemVersion] compare:@"7.0"] != NSOrderedAscending )
#define kAPPMAINBGCOLOR [Tool colorWithHexString:@"f0f2ed"]
#define kDEFAULTIMAGE [UIImage imageNamed:@"default_person"]
#define kBLACKTITLECOLOR [Tool colorWithHexString:@"a47945"]
#define kSEPARATORCOLOR [Tool colorWithHexString:@"d9d9d9"]
#define kLEFTVIEWCOLOR [Tool colorWithHexString:@"3d3d3d"]
#define kTITLECOLOR [Tool colorWithHexString:@"ff444f"]


@interface Tool : NSObject

//判断是否是正确的手机号
+ (BOOL)checkTel:(NSString *)str;

+(BOOL)checkMobile:(NSString *)mobile;
//ip地址校验
+ (BOOL)checkIpAddress:(NSString *)str;
//判断是否是正确的车牌号
+ (BOOL)checkCar:(NSString *)str;
//判断是否是正确的身份证号
+ (BOOL)checkPerson:(NSString *)str;
//设置导航条颜色 默认BgColor为全局使用颜色  titleColor为白色
+ (void)setNavBarBgColor:(UINavigationController *)nav;
//设置导航条颜色 默认BgColor为全局使用颜色  titleColor为白色
+ (void)setNavBarBgColor1:(UINavigationController *)nav;
//延迟执行的block
+ (void)performBlock:(void (^)(void))block afterDelay:(NSTimeInterval)delay;

//添加返回按钮
+ (void)addBackButton:(UIViewController*)ctrl;

//页面从nav下开始计算
+ (void)setEdgesForExtendedLayout:(UIViewController*)ctrl;

//设置button点击效果
+ (void)setBtnSelectedStyle:(UIButton*)sender Image:(NSString*)image;


//十六进制的颜色转换为UIColor
+ (UIColor *) colorWithHexString: (NSString *)color alpha: (float)alpha;

//弹出登录界面
+ (void)showLogin;


//设置nav的titleview
+ (void)setNavTitleView:(UIViewController*)ctrl;

//图片缩放到指定大小尺寸

+ (UIImage *)imageFromView:(UIView *)viewBac;

//根据文字获取label大小
+ (CGSize)getLabelSizeWithText:(NSString*)str AndSize:(CGSize)siz AndFont:(UIFont*)font;

//时间戳转时间
+ (NSString*)timestampToString:(NSString*)stamp Format:(NSString*)format;

//获取当前系统的时间戳
+(long)getTimeSp;

//时间转日期
+ (NSString*)weekdayStringFromDate:(NSDate*)inputDate;

//转正常格式日期
+(NSString *)changeTimeWithString:(NSString *)timestr;

//比较日期大小
+(int)compareOneDay:(NSDate *)oneDay withAnotherDay:(NSDate *)anotherDay;
//将时间戳转换成NSDate
+(NSDate *)changeSpToTime:(NSString*)spString;

//将NSDate按yyyy-MM-dd HH:mm:ss格式时间输出
+(NSString*)nsdateToString:(NSDate *)date;
//判断字符串是否为空
+ (BOOL) isBlankString:(NSString *)string;

+ (BOOL)isExistenceNetwork;
//数组拼接为字符串
+ (NSString *)StringConversionWithArr:(NSArray *)array;

//显示提示信息
+ (void)ShowpromptWithMsg:(NSString *)Msg;

//显示错误消息
+(void)showSmallMSG:(NSString *)MSG shake:(BOOL)shake;
//显示提示信息
+ (void)ShowpromptWithMsg1:(NSString *)Msg;

//显示label消息
+(void)showSmallMSG:(NSString *)MSG;

//处理距离
+(NSString *)dealDistanceWithLat:(CGFloat)lat andLng:(CGFloat)lng;

+(void)setTitle:(NSString *)title forVc:(UIViewController *)controller;

+ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;


+(UIViewController *)getCurrentVC;

//设置titleView
+(void)setTitleView:(NSString *)title toVc:(UIViewController *)vc;

@end
